<?php
// $Id$
/**
 * This file contains {@link Lock} which is part of the PHP Content Repository
 * (phpCR), a derivative of the Java Content Repository JSR-170,  and is 
 * licensed under the Apache License, Version 2.0.
 *
 * This file is based on the code created for
 * {@link http://www.jcp.org/en/jsr/detail?id=170 JSR-170}
 *
 * @author Travis Swicegood <travis@domain51.net>
 * @copyright PHP Code Copyright &copy; 2004-2005, Domain51, United States
 * @copyright Original Java and Documentation 
 *  Copyright &copy; 2002-2004, Day Management AG, Switerland
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, 
 *      Version 2.0
 * @package phpContentRepository
 * @subpackage Level2
 */

/**
 * Load the {@link phpCR} library file(s)
 */ 
require_once(dirname(__FILE__) . '/../phpCR.library.php');
phpCR::loadInterface('Item');

/**
 * Represents a lock placed on an item.
 *
 * Level 2 only
 *
 * A lock is associated with an {@link Item} and a user (not a {@link Ticket})
 *
 * @author PHP - Travis Swicegood <travis@domain51.net>
 * @copyright Copyright &copy; 2004-2005, Domain51
 * @package phpContentRepository
 * @subpackage Level2
 */
interface Lock 
{

   /**
    * Returns the user ID of the user who has this lock.
    *
    * @return mixed
    *   A user ID.
    */
    public function getOwner();
    
    
   /**
    * Returns the type of this lock. This standard specifies only one type of
    * lock: {@link LockType::WRITE_LOCK} though more can be supported by a
    * specific phpCR implementation.
    *
    * @see LockCapabilities::getSupportedLockTypes(), LockType
    * @return int
    *   The type of this lock.
    */
    public function getType();
    
    
   /**
    * Returns TRUE if this lock is a shared lock.
    *
    * @return bool
    *   TRUE if this is a shered lock, FALSE 
    *   otherwise.
    */
    public function isShared();
    
    
   /**
    * Returns the locked item.
    *
    * @return object
    *   An {@link Item} object.
    */
    public function getItem();
}

